package com.zyb.beiojbackendjudgeservice.codesandbox.impl;



import com.zyb.beiojbackendjudgeservice.codesandbox.CodeSandbox;
import com.zyb.beiojmodel.model.codesandbox.ExecuteCodeRequest;
import com.zyb.beiojmodel.model.codesandbox.ExecuteCodeResponse;
import com.zyb.beiojmodel.model.codesandbox.QuestionJudgeInfo;
import com.zyb.beiojmodel.model.enums.JudgeInfoMessageEnum;
import com.zyb.beiojmodel.model.enums.QuestionSubmitStatusEnum;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author 十八岁讨厌编程
 * @date 2025/2/8 10:01
 * @PROJECT_NAME beioj-backend
 * @description 示例代码沙箱
 */

@Component
public class ExampleCodeSandbox implements CodeSandbox {
    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        System.out.println("example");
        List<String> inputList = executeCodeRequest.getInputList();
        ExecuteCodeResponse executeCodeResponse = new ExecuteCodeResponse();
        executeCodeResponse.setOutputList(inputList);
        executeCodeResponse.setMessage("测试执行成功");
        executeCodeResponse.setStatus(QuestionSubmitStatusEnum.SUCCESS.getText());
        QuestionJudgeInfo judgeInfo = new QuestionJudgeInfo();
        judgeInfo.setMessage(JudgeInfoMessageEnum.ACCEPTED.getText());
        judgeInfo.setMemory(100L);
        judgeInfo.setTime(100L);
        executeCodeResponse.setJudgeInfo(judgeInfo);
        return executeCodeResponse;
    }
}
